Skip to content

feat(seer): Add Seer project connected repo endpoint#115199

Merged
srest2021 merged 42 commits into
masterfrom
srest2021/CW-1286
May 21, 2026
Merged

feat(seer): Add Seer project connected repo endpoint#115199
srest2021 merged 42 commits into
masterfrom
srest2021/CW-1286

Conversation

@srest2021
Copy link
Copy Markdown
Member

@srest2021 srest2021 commented May 8, 2026

Relates to CW-1286

Adds a Seer project single-repo endpoint ProjectSeerRepoEndpoint (GET/PUT/DELETE) with ProjectPermission.

  • GET: Returns the Seer project repo config (branch name, instructions, branch overrides) for a given repository. 404 if not connected, inactive, or unsupported provider.
  • PUT: Partial update — only updates fields present in the request body. Uses select_for_update on the SeerProjectRepository row. Replaces branch overrides if provided; preserves them if omitted. 404 if not found.
  • DELETE: Removes the Seer project repo. Branch overrides cascade-delete. 404 if not found.

All three methods filter by supported SCM providers (get_supported_scm_providers), so repos with unsupported providers return 404.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 8, 2026

CW-1286

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 8, 2026
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.62%

@srest2021 srest2021 closed this May 8, 2026
@srest2021 srest2021 reopened this May 8, 2026
Comment thread src/sentry/api/urls.py Outdated
Comment thread src/sentry/seer/autofix/utils.py Outdated
@getsentry getsentry deleted a comment from github-actions Bot May 19, 2026
Comment thread src/sentry/seer/autofix/utils.py Outdated
@getsentry getsentry deleted a comment from github-actions Bot May 19, 2026
@srest2021
Copy link
Copy Markdown
Member Author

@sentry review

Comment thread src/sentry/seer/autofix/utils.py Outdated
Comment thread src/sentry/seer/autofix/utils.py Outdated
@srest2021 srest2021 requested review from a team as code owners May 20, 2026 20:48
Comment thread src/sentry/seer/endpoints/organization_seer_project_repos.py Outdated
Base automatically changed from srest2021/CW-1286-utils to master May 20, 2026 20:57
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e93fc6. Configure here.

Comment thread src/sentry/seer/endpoints/organization_seer_project_repos.py Outdated
branchName: str


class ProjectRepoResponse(TypedDict):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the current SeerRepoDefinition built in the read path via build_repo_definition_from_project_repo.

@srest2021 srest2021 requested a review from a team as a code owner May 20, 2026 21:58
@srest2021 srest2021 removed the request for review from a team May 20, 2026 21:59
Comment thread src/sentry/seer/endpoints/project_seer_repos.py
Comment thread src/sentry/seer/endpoints/organization_seer_project_repos.py Outdated
Copy link
Copy Markdown
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@srest2021 srest2021 merged commit 56f38cb into master May 21, 2026
63 checks passed
@srest2021 srest2021 deleted the srest2021/CW-1286 branch May 21, 2026 18:26
natemoo-re pushed a commit that referenced this pull request May 21, 2026
Relates to CW-1286


Adds a Seer project single-repo endpoint **`ProjectSeerRepoEndpoint`**
(`GET`/`PUT`/`DELETE`) with ProjectPermission.

- **GET**: Returns the Seer project repo config (branch name,
instructions, branch overrides) for a given repository. 404 if not
connected, inactive, or unsupported provider.
- **PUT**: Partial update — only updates fields present in the request
body. Uses `select_for_update` on the SeerProjectRepository row.
Replaces branch overrides if provided; preserves them if omitted. 404 if
not found.
- **DELETE**: Removes the Seer project repo. Branch overrides
cascade-delete. 404 if not found.

All three methods filter by supported SCM providers
(`get_supported_scm_providers`), so repos with unsupported providers
return 404.

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
srest2021 added a commit that referenced this pull request May 21, 2026
Fixes CW-1286

Depends on #115199 and #115904

Adds a bulk Seer project repos endpoint **`ProjectSeerReposEndpoint`**
(`GET`/`POST`/`PUT`) at `/api/0/projects/{org}/{project}/seer/repos/`
with `ProjectPermission`.

### GET — List connected repos

Lists all connected Seer project repos for a project. Supports search by
`name` (substring, case-insensitive) and `provider` (exact match,
supports `=`, `!=`, `IN`, `NOT IN`, with or without `integrations:`
prefix), sorting by `name`/`-name`/`provider`/`-provider`, and offset
pagination. Excludes inactive repos and unsupported providers.

```
GET /api/0/projects/my-org/my-project/seer/repos/?query=relay&sortBy=-name
```

### POST — Add repos

Upserts repos by ID. Validates all repo IDs are active, belong to the
org, and have supported providers — returns 400 with invalid IDs if not.
Rejects empty lists, duplicate repo IDs, and duplicate branch overrides.

```
POST /api/0/projects/my-org/my-project/seer/repos/
{
  "repos": [
    {"repositoryId": 1, "branchName": "main", "instructions": "use pytest"},
    {"repositoryId": 2, "branchOverrides": [
      {"tagName": "environment", "tagValue": "production", "branchName": "release"}
    ]}
  ]
}
```

### PUT — Replace all repos

Replaces all connected repos for the project atomically. Accepts an
empty list to disconnect all repos. Same validation as POST for
non-empty lists.

```
PUT /api/0/projects/my-org/my-project/seer/repos/
{
  "repos": [
    {"repositoryId": 3, "branchName": "develop"}
  ]
}
```

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants